#ifndef FIGURE_H__
#define FIGURE_H__

#include <iostream>

class Figure
{
   double x, y;

public:

   Figure( double posX = 0, double posY = 0 ) : x(posX), y(posY) {}
   double getX() const                       { return x; }
   double getY() const                       { return y; }
   void  move( double posX, double posY )     { x = posX; y = posY; }
   virtual void  show( std::ostream & s ) const  = 0;
   virtual double area() const               = 0;
};

std::ostream & operator << (std::ostream & s, const Figure & f);

class Rectangle : public Figure
{
   double width;
   double height;

public:

   Rectangle() : Figure(), width(1), height(1) {}
   Rectangle( double posX, double posY, double aWidth, double aHeight )
      : Figure( posX, posY ), width( aWidth ), height( aHeight )
      {}
   Rectangle( const Rectangle & r )
      : Figure( r.getX(), r.getY() ), width( r.width ), height( r.height )
      {}
   virtual void  show( std::ostream & s ) const;
   virtual double area() const { return width*height; }
};

class Circle : public Figure
{
   double radius;

public:
   Circle() : Figure(), radius(1) {}
   Circle( double posX, double posY, double aRadius )
      : Figure( posX, posY ), radius( aRadius )
      {}
   Circle( const Circle & c )
      : Figure( c.getX(), c.getY() ), radius( c.radius )
      {}
   virtual void  show( std::ostream & s ) const;
   virtual double area() const { return 3.1415926*radius*radius; }
};

#endif //FIGURE_H__
